<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>6.动态警告框</title>

<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

    <link href="../css/bootstrap.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../js/bootstrap.js"></script>

<script type="text/javascript">
	
	$(document).ready(function(e) {
        
		//关闭警告框
		$('#btn1').click(function(e) {
            $('#myAlert1,#myAlert2').alert('close');
        });
		
		//关闭事件
		$('#myAlert').on('closed.bs.alert',function(){
			alert('警告框被关闭');	
		});
		
    });

</script>

</head>

<body>
	
    <div class="container">
    
    	<div id="myAlert1" class="alert alert-danger alert-dismissable">
        	<button type="button" class="close" data-dismiss="alert">&times;</button>
        	请一定要先收到货<strong>再付款！</strong>否则非常有可能钱货两空！
        </div>
        
        <div id="myAlert2" class="alert alert-info alert-dismissable">
        	<button type="button" class="close" data-dismiss="alert">&times;</button>
        	<h3>温馨提示</h3>
            <p>请保管好您的随身物品，丢失本店一概不负责！贵重物品请寄存到前台</p>
            <p>
            	<button type="button" class="btn btn-primary" data-dismiss="alert">好，我知道了</button>
                <button type="button" class="btn btn-info">不，我不接受</button>
            </p>
        </div>
        
        <button id="btn1" type="button" class="btn btn-primary">关闭警告框</button>
    
    </div>
       
</body>
</html>